<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <select>
        <option>红色</option>
        <option>蓝色</option>
    </select>
    <div class="content">
        当选中select上的标签 将content中的内容设置为指定的颜色
    </div>
    <script>
        // 当选中select上的标签 将content中的内容设置为指定的颜色
        var sel = document.querySelector('select')
        var div = document.querySelector('div')
        div.style.color = sel.value == '红色' ? 'red' : 'skyblue'
        sel.onchange = () => {
            div.style.color = sel.value == '红色' ? 'red' : 'skyblue'
        }
    </script>
</body>

</html>